import numpy as np
from matplotlib import pyplot as plt
import random

from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF

y = []
X = np.array(list(range(80)))[:, np.newaxis]
for i in range(len(X)):
    y.append(20+X[i]+random.random()*50)

kernel = RBF(10, (0.01, 1e2))

fig, axs = plt.subplots(1,3, figsize=(17,3))
for i, alpha in zip([0,1,2], [0.01, 0.05, 0.08]):
    gp = GaussianProcessRegressor(alpha=alpha, kernel = kernel)
    gp.fit(X, y)
    y_pred, sigma = gp.predict(X, return_std=True)

    axs[i].plot(X, y, 'y.', markersize=11, label='Samples')
    axs[i].plot(X, y_pred, 'k-', label='Prediction')
    axs[i].legend()
    axs[i].set_title('Alpha = ' + str(alpha))
    axs[i].grid()
plt.show()
